import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout'

Vue.use(Router)

export default new Router({
  // mode: 'history', // 需要服务端支持
  scrollBehavior: () => ({ y: 0 }),
  routes: [
    {
      path: "/",
      redirect: "/real-time-monitor/index",
      hidden: true,  // 不在导航栏显示
    },
    {
      path: "/login",
      hidden: true,
      name: "Login",
      component: () => import("@/views/login/index"),
    },
    {
      path: '/real-time-monitor',
      component: Layout,
      meta: { title: '实时监控' },
      children: [
        {
          path: 'index',
          name: 'RealTimeMonitor',
          component: () => import('@/views/real-time-monitor/index')
        }
      ]
    },
    {
      path: '/monitor-playback',
      component: Layout,
      meta: { title: '监控回放' },
      children: [
        {
          path: 'index',
          name: 'MonitorPlayback',
          component: () => import('@/views/monitor-playback/index')
        }
      ]
    },
    {
      path: '/data-analysis',
      component: Layout,
      meta: { title: '数据分析' },
      children: [
        {
          path: 'index',
          name: 'DataAnalysis',
          component: () => import('@/views/data-analysis/index')
        }
      ]
    },
    {
      path: '/set-rule',
      component: Layout,
      meta: { title: '规则设置' },
      children: [
        {
          path: 'index',
          name: 'SetRule',
          component: () => import('@/views/set-rule/index')
        }
      ]
    }
  ]
})
